package com.hgvip.service;

import com.hgvip.entity.City;
import com.hgvip.mapper.CityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by arnold.zhu on 6/13/2017.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CityService {

    @Autowired
    private CityMapper cityMapper;

    public List<City> getCities() {
        return cityMapper.getCities();
    }

    public int addCity(City city) {
        cityMapper.addCity(city);
        if(true) {
            throw new RuntimeException();
        }
        return 1;
    }
}
